package com.yenlien.traceyun.plant.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.yenlien.traceyun.business.interceptor.DataAuth;
import com.yenlien.traceyun.plant.entity.ReapDetail;
import com.yenlien.traceyun.plant.service.ReapDetailService;
import com.yenlien.traceyun.webase.controller.BaseController;

/**
 * 采收详情
 *
 * @author maybe
 * @date 2020年7月27日
 */
@RestController
@RequestMapping("/reapDetail")
public class ReapDetailController extends BaseController {
    @Autowired
    private ReapDetailService reapDetailService;

    //列表查询
    @DataAuth
    @RequestMapping(value = "/findByList", method = RequestMethod.POST)
    public Object findByList(@RequestBody ReapDetail reapDetail) {
        return buildPage(reapDetailService.findByList(reapDetail));
    }

    //查询所有收获品名列表
    @DataAuth
    @RequestMapping(value = "/findAllBreed", method = RequestMethod.GET)
    public Object findAllBreed() {
        return success(reapDetailService.findAllBreed());
    }

    //根据ID查询详情
    @RequestMapping(value = "/findById/{id}", method = RequestMethod.GET)
    public Object findById(@PathVariable("id") String id) {
        return success(reapDetailService.findById(id));
    }
}
